package com.xc.controller.protol;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.common.ServerResponse;
import com.xc.pojo.UserRecharge;
import com.xc.service.IUserRechargeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


/**
 *
 * @author mipha
 * @version 1.0
 * @date 2019/2/20 11:10 AM
 */
@Controller
@RequestMapping("/user/recharge/")
@Slf4j
public class UserRechargeController {

    @Autowired
    IUserRechargeService iUserRechargeService;


    /**
     *  查询用户充值记录
     * @param pageNum
     * @param pageSize
     * @param payChannel
     * @param orderStatus
     * @param request
     * @return
     */
    @RequestMapping("list.do")
    @ResponseBody
    public ServerResponse<PageInfo> list(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                    @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
                                    @RequestParam(value = "payChannel",required = false) String payChannel,
                                    @RequestParam(value = "orderStatus",required = false) String orderStatus,
                                    HttpServletRequest request){
        return iUserRechargeService.findUserChargeList(payChannel,orderStatus,request,pageNum,pageSize);
    }


    /**
     *  发起充值订单
     * @param amt       金额
     * @param payType   支付方式
     * @param request
     * @return
     */
    @RequestMapping("inMoney.do")
    @ResponseBody
    public ServerResponse inMoney(String amt,String payType,HttpServletRequest request){
        return iUserRechargeService.inMoney(amt,payType,request);
    }






}
